package cz.uhk.ppro.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import cz.uhk.ppro.form.DodavatelForm;

public class DodavatelValidator implements Validator{

	public boolean supports(Class<?> clazz) {
		return DodavatelForm.class.isAssignableFrom(clazz);
	}

	public void validate(Object target, Errors errors) {
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "nazev", "dodavatelNazev.required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "ulice", "ulice.required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "cp", "cp.required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "mesto", "mesto.required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "psc", "psc.required");
		
	}

}
